package com.chen.demo;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class Controller {
    @PostMapping("hello")
    public void hello(@Validated @RequestBody User user, BindingResult result){
        System.out.println(result.getAllErrors());
    }
}
